#include<stdio.h>
const int maxn=100010;
int main()
{
	int s[maxn],ans;
	int n,max=-100010,min=100010,x,y;
	scanf("%d",&n);
	while(n--){
		while(scanf("%d",&ans)!=EOF){
			if(max<ans)
				max=ans;
			if(min>ans)
				min=ans;
			s[ans]++;
		}
	}
	for(int i=min;i<=max;i++){
		if(!s[i])
			x=i;
		if(s[i]==2)
			y=i;
	}
	printf("%d %d",x,y);
	return 0;
}
